<template>
  <div class="my-counter">
    <button
      @click="goodItem.goods_count--"
      :disabled="goodItem.goods_count === 1"
      type="button"
      class="btn btn-light"
    >
      -
    </button>
    <input type="number" class="form-control inp" :value="goodItem.goods_count" />
    <button
      @click="goodItem.goods_count++"
      :disabled="goodItem.goods_count === 10"
      type="button"
      class="btn btn-light"
    >
      +
    </button>
  </div>
</template>

<script>
export default {
  props: {
    /*  //商品数据 */
    goodItem: {
      type: Object,
      /* 如果是复杂类型，默认值需要通过函数返回 */
      default: () => ({})
    }
  }
}
</script>

<style lang="less" scoped>
.my-counter {
  display: flex;
  .inp {
    width: 45px;
    text-align: center;
    margin: 0 10px;
  }
  .btn,
  .inp {
    transform: scale(0.9);
  }
}
</style>
